package com.welsmann.app.start.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.welsmann.app.start.dao.BaseDAO;
import com.welsmann.app.start.dao.IHolidayDAO;
import com.welsmann.app.start.entity.Holiday;

/**
 * 假日DAO
 * 
 * @author Welsmann
 */
@Component("HolidayDAO")
public class HolidayDAO extends BaseDAO implements IHolidayDAO {

	private HibernateTemplate _ht = null;
	
	@Override
	public List<Holiday> getHolidayByDate(int month, int day) {
		_ht = new HibernateTemplate(super.sessionFactory);
		List<Holiday> lstHoliday = _ht.find(
				"from Holiday where month = ? and day = ? order by type",
				month, day);
		return lstHoliday;
	}

	@Override
	public List getAll() {
		_ht = new HibernateTemplate(super.sessionFactory);
		return _ht.find("from Holiday order by month,day,type");
	}

}
